/*
 * Copyright (c) 2007
 *	Alberto Magni, Maggioni Marcello
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */

package Database;
import exceptions.DatabaseException;
/**UsersDB provides methods to manage the users who want to send an email.
 * @author Marcello Maggioni*/
public interface UsersDB 
{
    /**Add a user to the data base.
     *@param username the username of the user to be added
     *@param password the password of the user to be added
     *@param name the full name of the user to be added*/
    public void addUser(String username, String password, String name) throws DatabaseException;
//------------------------------------------------------------------------------
    /**Allow to the administrator to enable a user to send emails.
     *@param username the username of the user to be given the authorization*/
    public void enableUser(String username) throws DatabaseException;
//------------------------------------------------------------------------------
    /**Allow to the administrator to disble a user.
     *@param username the username of the user to disable*/
    public void disableUser(String username) throws DatabaseException;
//------------------------------------------------------------------------------
    /**Return the full name of the given username.
     *@param username the username of the user 
     *@return the full name of the user*/
    public String getName(String username) throws DatabaseException;
//------------------------------------------------------------------------------
    /**Delete a username from the list.
     *@param username the user to be deleted*/
    public void deleteUser(String username) throws DatabaseException;
//------------------------------------------------------------------------------
    /**Set an user as administrator.
     *@param username the user to be set as administrator
     *@param value if is true the user is set a administrator, else no*/
    public void setAdmin(String username, boolean value) throws DatabaseException;
//------------------------------------------------------------------------------
    /**Verify is an user is administrator.
     *@param username the user who is asking about*/
    public boolean isAdmin(String username) throws DatabaseException;
//------------------------------------------------------------------------------
    /**Return the list of all the enabled users.
     *@return the list of all the enabled users*/
    public String[] getEnabledUsers() throws DatabaseException;
//------------------------------------------------------------------------------
    /**Return the list of all the disabled users.
     *@return the list of all the disabled users*/
    public String[] getDisabledUsers() throws DatabaseException;
//------------------------------------------------------------------------------
    /**Chance the password of given user.
     *@param username the username of the user who is changing password
     *@param newpassword the new password of the user who is changing password*/
    public void changePassword(String username, String newpassword) throws DatabaseException;
//------------------------------------------------------------------------------
    /**Check the correctness of the couple username, password.
     *@param username the username of the user who is logging in
     *@param password the password of the user who is logging in
     *@return true if the couple is correct, else false*/
    public boolean verifyUser(String username, String password) throws DatabaseException;
}
